<template>
	<view>
	<view class="header">	
		<view style="background-image: url(../../static/background/user-header.png)" class="beijing">
				<image src="../../static/default-avatar.png" mode="" class="userImage" @click="toLogin"></image>
			<view class="userInfo" @click="toLogin">
				<p>{{getInfo.userInfo?getInfo.userInfo.mobile:'未登录'}}</p>
				<p>{{getInfo.userInfo?getInfo.userInfo.nick_name:'点击登录账号'}}</p>
			
			</view>		
		</view>
		</view>
		<view class="main">
		<view class="content">
	<view class="top">
			<p class="line">--</p>
			<view class="">
				账户余额
			</view>
	 </view>
	 <view class="top">
	 		<p class="line">--</p>
	 		<view class="">
	 			积分
	 		</view>
	  </view>
		<view class="top">
				<p class="line">--</p>
				<view class="">
					优惠券
				</view>
		 </view>
		 <view class="box">
		 </view>
		
		 <view class="top">
		 		<text class="iconfont icon-qianbao"></text>
		 		<view>
		 			我的钱包
		 		</view>
		  </view>
			</view>
			<view class="order">
				<view class="center">
						<text class="iconfont icon-qpdingdan"></text>
						<view class="dingdan">
							全部订单
						</view>
				 </view>
				 <view class="center">
				 		<text class="iconfont icon-daifukuan"></text>
				 		<view class="dingdan">
				 			待支付
				 		</view>
				  </view>
					<view class="center">
							<text class="iconfont icon-daifahuo"></text>
							<view class="dingdan">
								待发货
							</view>
					 </view>
					 <view class="center">
					 	<text class="iconfont icon-daishouhuo"></text>
					 		<view class="dingdan">
					 			待收货
					 		</view>
					  </view>
			</view>
			<view class="myService-wrap">
				<view class="myService">
					<h2>我的服务</h2>
				<view class="service">
					<view class="bottom">
						<text class="iconSize iconfont icon-shouhuodizhi"></text>
						<view class="fuwu">
							收货地址
						</view>
					</view>
					<view class="bottom">
						<text class="iconSize iconfont icon-lingquan"></text>
						<view class="fuwu">
							领券中心
						</view>
					</view>
					<view class="bottom">
						<text class="iconSize iconfont icon-youhuiquan"></text>
						<view class="fuwu">
							优惠券
						</view>
					</view>
					<view class="bottom">
						<text class="iconSize iconfont icon-bangzhu"></text>
						<view class="fuwu">
						我的帮助
						</view>
					</view>
					<view class="bottom">
						<text class="iconSize iconfont icon-kefu"></text>
						<view class="fuwu">
							在线客服
						</view>
					</view>
					<view class="bottom">
						<text class="iconSize iconfont icon-jifen"></text>
						<view class="fuwu">
							我的积分
						</view>
					</view>
					<view class="bottom">
						<text class="iconSize iconfont icon-shouhou"></text>
						<view class="fuwu">
							退换售后
						</view>
					</view>
					<view class="bottom">
						<text class="iconSize iconfont icon-view-tile"></text>
						<view class="fuwu">
						分销中心
						</view>
					</view>
				</view>
				</view>
			</view>
			<view class="layout">
				<!-- <text class="layoutlogin">退出登录</text> -->
				<button type="default" @click="layout">退出登录</button>
			</view>
	</view>
	
	</view>
</template>

<script>
	

	
	export default {
		data() {
			return {
			   userInfo:{},
				 getInfo:{}
			};
		},
	
beforeMount(){
	let getUserInfo=uni.getStorageSync('token')
	if(getUserInfo){
		this.userInfo=getUserInfo
	}
	this.getUserInfo()
	
},
		methods:{
			//退出登录
			layout(){
				try {
				    uni.clearStorageSync(this.getInfo);
						console.log(1)
				} catch (e) {
				   console.log(e)
				}
			},
			async getUserInfo(){
				const result=await uni.request({
					url:'https://yoshop.zyf520.xyz/index.php?s=/api/user/info',
					 header: {
					    'access-token': this.userInfo,
							'platform':'H5'
							//自定义请求头信息
					    },
					    success: (res) => {
					      if(res.data.status==200){
									this.getInfo=res.data.data
								}
					        
					    }
				})
				console.log(this.getInfo)
				
			},
			//如果没有登录登录页面
			toLogin(){
				wx.navigateTo({
					url:'/pages/login/login'
				})
			}
		},
		
	
		
		
	}
</script>

<style lang="stylus">
	
			page
				background rgb(250,250,250)
			.header
				width 400px
				height 170px
				position relative
				display flex
				.top
					font-size 30upx
				.beijing
					width 100%
					height 100%
					background-size cover
				.userImage
					width 110upx
					height 110upx
					border-radius 50%
					position absolute
					bottom 60upx
					margin-left 30upx
				.userInfo
					position absolute
					bottom 60upx
					left 100upx
					margin-left 60upx
					p
						&:first-child
							font-size 35upx
							font-weight 700
							color rgb(197,154,70)
						&:last-child
							font-size 26upx
							margin-top 20upx
							color rgb(197,154,70)
			
			.content
				display flex	
				height 156upx
				background-color white	
				align-items center
				.top
					text-align center
					flex 1	
					align-items center
					font-size 28upx
					color rgb(104,104,104)
				 
					p
						color red
				.box
					width 2upx
					height 90upx
					background-color #ccc	
			.order
				display flex
				background-color white
				margin 24upx 0 24upx
				height 156upx
				align-items center
				box-shadow:0 2px 0px rgb(241,241,241);
				.center
					flex 1
					text-align center
					font-size 30upx
					color rgb(104,104,104)
					.dingdan
						padding-top 10upx
					.icon
						margin-bottom 20upx
					
		.myService-wrap
			padding 0 20upx
			.myService
				background-color white
				padding 10upx 30upx 30upx
				box-shadow:0 2px 0px rgb(241,241,241);
				
				h2
					color rgb(88,89,90)
					padding-top 20upx

				.service
					display flex
					justify-content space-between
					flex-wrap wrap
					margin-top 20upx
					.bottom
						text-align center
						margin-right 20upx
						margin-bottom 40upx
						&:nth-child(4n)
							margin-right 0
						.iconSize
							font-size 44upx
							color rgb(255,73,22)
							margin-bottom 20upx
						.fuwu
							margin-top 20upx
							color rgb(109,109,109)
		.layout
			text-align center
			margin 60upx auto
			button
				width 390upx
				height 80upx
				line-height 80upx
				
			// .layoutlogin
			// 	border-radius 30upx
			// 	border 1px solid #ccc
			// 	padding 10upx 100upx
			// 	color rgb(97,97,97)
				
				
</style>
			
				 
				 
					
			
					
					
			
				
					
					
									
							
				
				
			
		
		
		     
			
		
				
		
				
</style>
